package io.gitee.zhangbinhub.admin.deploy.bus.publish

import io.gitee.zhangbinhub.admin.common.event.CloudBusEventContent
import io.gitee.zhangbinhub.admin.common.event.ExecuteBusEvent
import io.gitee.zhangbinhub.admin.deploy.constant.DeployConstant
import org.noear.solon.annotation.Component
import org.noear.solon.cloud.CloudClient

/**
 * @since JDK 11
 */
@Component
class DeployEventPublish {
    fun doNotifyExecuteDeploy(deployTaskId: String) {
        ExecuteBusEvent(
            CloudBusEventContent(message = DeployConstant.BUS_MESSAGE_EXECUTE_DEPLOY, paramList = listOf(deployTaskId))
        ).apply {
            CloudClient.event().publish(this.toEvent())
        }
    }
}
